// 引入vue
import { ref, onMounted, getCurrentInstance } from "vue"
// 引入防抖节流方法
import { debounce, throttle } from "@/utils/save"

// 导出 图表适配的方法
const setResize = () => {
    console.log('111', getCurrentInstance());
    let { proxy } = getCurrentInstance() as any

    onMounted(() => {
        // console.log('222', proxy.$refs.myEcharts.Charts);
        window.addEventListener("resize", throttle(() => {
            // console.log(1223);
            // 判断图表是否存在
            proxy.$refs.myEcharts.Charts && proxy.$refs.myEcharts.Charts.resize();
        }, 200))
    })

}

export default setResize